package com.yangquan.ayuan.synchronizedTest;

/**
 * synchronized 对实例方法加锁
 * 锁住的是当前对象 this
 */
public class SynchronizedInstanceMethodExample {
    public synchronized void instanceMethod() {
        System.out.println("Instance synchronized method");
    }

    public static void main(String[] args) {
        SynchronizedInstanceMethodExample instanceMethodExample = new SynchronizedInstanceMethodExample();
        instanceMethodExample.instanceMethod();
    }
}